package com.lanyou.esb.service;

import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

@Service
public class SettingPortService implements ApplicationListener<EmbeddedServletContainerInitializedEvent>{

	private static int serverPort;
	
	@Override
	public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
		// TODO Auto-generated method stub
		serverPort = event.getEmbeddedServletContainer().getPort();
	}

	public static int getPort() {
        return serverPort;
    }
}
